﻿package plugin.shop.component
{
    import __AS3__.vec.*;
    import cmd.*;
    import flash.display.*;
    import manager.*;
    import morn.core.components.*;
    import plugin.shop.*;

    public class NewReBayPage extends Sprite
    {
        private var itemList:Vector.<NewReBayItem>;
        private var tools:Array;
        private var sprite:Sprite;
        private var items:Object;

        public function NewReBayPage()
        {
            this.items = ConfigDictionary.data.item;
            return;
        }// end function

        public function getList(param1:Object) : void
        {
            var _loc_2:Array = null;
            var _loc_3:Object = null;
            var _loc_4:int = 0;
            var _loc_5:NewReBayItem = null;
            while (((this.parent as ShopUICtrl).panel1 as Panel).numChildren > 0)
            {
                
                ((this.parent as ShopUICtrl).panel1 as Panel).removeChildAt(0);
            }
            this.itemList = new Vector.<NewReBayItem>;
            if (param1 && param1.source)
            {
                _loc_2 = param1.source;
                _loc_4 = 0;
                while (_loc_4 < _loc_2.length)
                {
                    
                    _loc_3 = _loc_2[_loc_4];
                    if (_loc_3[2] == 2)
                    {
                        _loc_3[4] = this.items[_loc_3[0]];
                    }
                    _loc_5 = new NewReBayItem();
                    _loc_5.x = 165 * int(_loc_4 % 2);
                    _loc_5.y = (65 + 8) * int(_loc_4 / 2);
                    ((this.parent as ShopUICtrl).panel1 as Panel).addChild(_loc_5);
                    this.itemList.push(_loc_5);
                    _loc_3.index = _loc_4;
                    this.itemList[_loc_4].data = _loc_3;
                    _loc_4++;
                }
            }
            return;
        }// end function

        override public function set visible(param1:Boolean) : void
        {
            super.visible = param1;
            if (this.visible)
            {
                PluginManager.instance.sendToServer("shop", CMDShop.GetList, null);
            }
            return;
        }// end function

    }
}
